home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_45919.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  24 lines

  1. -- card: 45919 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. evaluating the part of the expression containing the operator yields a usable value as well.  The '++' and '--' operators may be used in prefix form (preceding the operand) or in postfix form (following the operand) depending on whether the variable should be incremented/decremented BEFORE evaluation or AFTER evaluation.  For example, the following expression increments both a and b yet assigns (a+1) times b to c:
  11.  
  12.     c = ++a * b++;
  13.  
  14. C also provides shorthand operators for assigning to a variable the effect of adding, subtracting, multiplying, dividing, or taking the integer remainder of this variable with another value.  The following demonstrates the advantages in efficiency and clarity afforded by these operators:
  15.  
  16.     f_array[index_function(i,j,k)] = f_array[index_function(i,j,k)] + x;
  17.  
  18.     f_array[index_function(i,j,k)] += x;     /* alternative using shorthand operator */
  19.  
  20. The first statement requires evaluation of the index function twice, and requires the 
  21.  
  22. -- part contents for background part 7
  23. ----- text -----
  24. 143